<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <include file="Public:jquery" />
        <include file="Public:dialog" />
        <include file="Public:editor" />
        <include file="Public:startapp" />
        <include file="Public:startmoo" />
        <script type="text/javascript">
        	
        	var editor;
			KindEditor.ready(function(K){
				editor = K.create("#content",{
					uploadJson:'__APP__/uploadfile/uploadeditor',
					allowFileManager:true,
					width : "100%",
					fileManagerJson:'__APP__/filemanage/viewlist',
					afterUpload:function(data){
						if($("#content_attachment").val() == ""){
			       			$("#content_attachment").attr("value",data);
			       		}else{
			       			$("#content_attachment").attr("value",$("#content_attachment").val()+"|"+data);
			       		}
					}
				});
			});
        	
            $(function(){
                
                $("#upthumb").click(function(){
					art.dialog.open('{:U("Thumbcut/uploadthumb")}',{
						title : '上传裁切形象照',
						width : 880,
						height : 550,
						init : function(){
							art.dialog.removeData('thumb');
						},
						close : function(){
							var value = art.dialog.data('thumb');// 读取B页面的数据
							if (value !== undefined) {
								document.getElementById('thumb').value = value;
								$("#thumb_pic_tr").show();
								$("#thumb_pic").attr("src",value);
							}
						},
						lock : true
					});
				});
				
				
				
				
				_checkpress("input[name='title']");
				$("form").submit(function(){
					
					if (_checkform("input[name='title']",'*标题不能为空') == false) return false;
					
				});
            });
            
        </script>
    </head>
    <body>
        <include file="Public:header" />
        
        <div class="layout">
            
            <include file="Public:position" />{$vo.title}</div>
            
            <table class="warp" cellpadding="0" cellspacing="0">
                <tr>
                    <td class="sidebar" valign="top">
                        <include file="Public:sidebar" />
                    </td>
                    <td class="contents" valign="top">
                                              
                        <div class="a_table">
					    	<form action="__URL__/update" method="post">
							<input type="hidden" name="content_attachment" id="content_attachment" value="{$vo.content_attachment}" />
							<input type="hidden" name="id" value="{$vo.id}" />
							<table cellspacing="1" width="100%" class="form_table">
								<tr>
									<td align="right">标题名称</td>
									<td align="left"><input type="text" name="title" class="input_text w480" value="{$vo.title}" /></td>
								</tr>
								<tr>
									<td align="right">分类</td>
									<td align="left">
										<select name="cid" class="input_text" style="width:auto; font-family: Verdana;">
											<option value="pselect">请选择分类</option>
											{$option}
										</select>
									</td>
								</tr>
								<tr>
									<td align="right">属性</td>
									<td align="left">
										<input type="checkbox" name="set_top"<php>if($vo['set_top'] == 1){</php> checked="checked"<php>}</php> /> 置顶 &nbsp;&nbsp;
										<input type="checkbox" name="recommend"<php>if($vo['recommend'] == 1){</php> checked="checked"<php>}</php> /> 推荐 &nbsp;&nbsp;
									</td>
								</tr>
								<tr>
									<td align="right">状态</td>
									<td align="left">
										<input type="radio" name="status" value="1"<php>if($vo['status'] == 1){</php> checked="checked"<php>}</php> /> 显示 &nbsp;&nbsp;
										<input type="radio" name="status" value="0"<php>if($vo['status'] == 0){</php> checked="checked"<php>}</php> /> 隐藏 &nbsp;&nbsp;
									</td>
								</tr>
								<php>
									if (isset($_SESSION['the_end_thumb_cut'])) {
										$thumb_path_yes = trim($_SESSION['the_end_thumb_cut'],'.');
									}else{
										$thumb_path_yes = '';
									}
								</php>
								<tr>
									<td align="right">形象照</td>
									<td align="left">
										<php>if(!empty($vo['thumb'])){</php>
										<input type="text" name="thumb" id="thumb" value="{$vo['thumb']}" class="input_text w280" align="absmiddle" /> 
										<php>}elseif(isset($_SESSION['the_end_thumb_cut']) && !empty($_SESSION['the_end_thumb_cut'])){</php>
										<input type="text" name="thumb" id="thumb" value="{$thumb_path_yes}" class="input_text w280" align="absmiddle" />
										<php>}else{</php>
										<input type="text" name="thumb" id="thumb" class="input_text w280" align="absmiddle" />
										<php>}</php>
										<input type="button" id="upthumb" class="default_bb" value="上传形象照" /><span style="margin-left: 90px;"> *(上传图片不要超过600px*600px，此功能可再次裁切。)</span>
									</td>
								</tr>
								<php>if(!empty($vo['thumb'])){</php>
								<tr id="thumb_pic_tr">
									<td align="right">&nbsp;</td>
									<td align="left"><img src="__PUBLIC__/{:C('DIR_ATTCH_PATH')}/{$vo['thumb']}" id="thumb_pic" /></td>
								</tr>
								<php>}elseif(isset($_SESSION['the_end_thumb_cut']) && !empty($_SESSION['the_end_thumb_cut'])){</php>
								<tr id="thumb_pic_tr">
									<td align="right">&nbsp;</td>
									<td align="left"><img src="{$thumb_path_yes}" id="thumb_pic" /></td>
								</tr>
								<php>}else{</php>
								<tr id="thumb_pic_tr">
									<td align="right">&nbsp;</td>
									<td align="left"><img src="__PUBLIC__/images/no_thumb.jpg" id="thumb_pic" /></td>
								</tr>
								<php>}</php>
								<tr>
									<td align="right">详细介绍</td>
									<td align="left"><textarea name="content" id="content" style="width: 90%; height:260px;">{$vo.content}</textarea></td>
								</tr>
								<tr>
									<td align="right"></td>
									<td align="left">
										<div class="submit_default_box">
											<input type="submit" class="submit_default" name="attachment" value="提交表单" />
											<span class="submit_default_icon" id="submit_icon"></span>
										</div>
									</td>
								</tr>
							</table>
							</form>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        
        <include file="Public:footer" />
    </body>
</html>